<template>
  <div>
    <el-form ref="formRef" :model="form">
      <div class="inlineCss">
        <el-form-item label="职业工种">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="职业等级">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="培训时间">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
      </div>
      <div class="inlineCss">
        <el-form-item label="培训方式">
          <el-radio-group v-model="form.radio">
            <el-radio label="1">线上</el-radio>
            <el-radio label="2">线下</el-radio>
            <el-radio label="3">线下 + 线上</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="缴费状态">
          <el-radio-group v-model="form.radio">
            <el-radio label="1">是</el-radio>
            <el-radio label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <el-form-item label="缴费证明">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
      <el-form-item v-if="leftClick == 2" label="参培人员信息导入">
        <div>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            :file-list="form.imageUrl"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <span class="imgtext"
            >支持格式:.rar .zip .doc .docx .pdf,单个文件不能超过20mb</span
          >
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { reactive, ref, toRefs } from "vue";
const props = defineProps({
  leftClick: Number,
});
const formRef = ref();
const state = reactive({
  form: {},
});

let { form } = toRefs(state);

const submitForm = () => {
  formRef.value.validate((valid) => {
    if (valid) {
      console.log("提交表单:", form.value);
    }
  });
};
</script>

<style lang="scss" scoped>
.inlineCss {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;

  .el-form-item {
    flex: 1;
    min-width: 200px;
  }
}

.el-form-item {
  margin-bottom: 22px;
}
.imgtext {
  font-size: 12px;
  color: #999;
}
</style>
